using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMComprasDet
    {
        public BMComprasDet(string coneccion) 
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private ComprasDet oComprasDet = new ComprasDet();
        private List<ComprasDet> listaComprasDet = new List<ComprasDet>();
        private DAComprasDet daComprasDet = new DAComprasDet();

        #region BMComprasDetInsert
        public void BMComprasDetInsert(ComprasDet comprasDet)
        {
            try
            {
                daComprasDet.DAComprasDetInsert(connection, comprasDet);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMComprasDetGetAll
        public List<ComprasDet> BMComprasDetGetAll(ComprasDet comprasDet)
        {
            try
            {
                listaComprasDet = daComprasDet.DAComprasDetGetAll(connection, comprasDet);
                return listaComprasDet;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMComprasDetGetAllByArticulo
        public List<ComprasDet> BMComprasDetGetAllByArticulo(ComprasDet comprasDet, Compras compraD, Compras compraH)
        {
            try
            {
                listaComprasDet = daComprasDet.DAComprasDetGetAllByArticulo(connection,comprasDet,compraD,compraH);
                return listaComprasDet;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMComprasDetDelete
        public void BMComprasDetDelete(ComprasDet comprasDet)
        {
            try
            {
                daComprasDet.DAComprasDetDelete(connection, comprasDet);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}
